        //index.js
//获取应用实例

const app = getApp()
//引入文件

Page({
  data: {
    // nav
    nav:{item01: "简介" , item02: "推荐"},
    curIndex: "x0",
    left: "0",
    // info
    info:{},
    // id为产品ID
    recommend:[],
    hasRecommend:false
  },
 
  onLoad:function(e){
    var that=this;
    this.setData({
      id:e.id
    })
  //  wx.setNavigationBarTitle({
    //  title: that.data.title
    //})
    // 专家数据
    wx.request({
       url: 'https://soya.91soya.com/api/typeshow/' + e.id,
       method: "get",
       success: function (res) {
         var resp = res.data;
         console.log(res)
         that.setData({
           info: { 
            id: resp.id, 
            name: resp.name,
            job: resp.job, 
            honor01: resp.honor_1,
            honor02: resp.honor_2, 
            num: resp.num, 
            headImg: " https://soya.91soya.com/uploads/" +resp.head_img, 
            content: resp.content,
            },
         })
        },
      fail: function () {}
     })


    // 项目数据
    wx.request({
      url: 'https://soya.91soya.com/api/project/',
      method: "get",
      success: function (res) {
        var resp = res.data;
        console.log(res)
        var a = [];
        for (var i = 0; i < resp.length; i++) {
          a[i] = { id: resp[i].id, img: " https://soya.91soya.com/uploads/" + resp[i].type_img, name: resp[i].name, content: resp[i].text }
        }
        that.setData({
          recommend: a
        })
      },
      fail: function () {
        that.setData({
          Type: [
            { id: 1, tid: 1, typeName: "标题", typeImg: "/imgs/01a.png", }
          ]
        })
      }
    })

    //推荐数据

    // wx.request({
    //   url: 'https://soya.91soya.com/api/typeinfo/' + e.id,
    //   method: "get",
    //   success: function (res) {
    //     var resp = res.data;
    //     console.log(resp)
    //     if(resp!=[]){
    //       var a = [];
    //       for (var i = 0; i < resp.length; i++) {
    //         a[i] = { id: resp[i].id, pid: resp[i].pid, recommendImg: " https://soya.91soya.com/uploads/" + resp[i].img, recommendTitle: resp[i].pro_name }
    //       }
    //       that.setData({
    //         recommend: a,
    //         hasRecommend:true
    //       })
    //     }
    //   },
    //   fail: function () {}
    // })
  },
  onShareAppMessage: function () {
    var that = this;
    return {
      title: that.data.title,
      // desc: '来来来一起种植牙啊',
      path: '/pages/expert/expert?id=' + that.data.id
    }
  },
  Nav: app.Nav(this),

})
